package com.xunk.scene.domain;

import com.xunk.common.core.annotation.Excel;
import com.xunk.common.core.utils.StringUtils;
import com.xunk.common.core.web.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;


/**
 * @ProjectName: HIM
 * @Package: com.xunk.scene.domain
 * @ClassName: ActionResult
 * @Author: luanzhiwei
 * @Description: 动作执行结果记录表
 * @Date: 2021/5/6 10:12
 * @Version: 1.0
 */
@Data
@ToString
@NoArgsConstructor
@EqualsAndHashCode
public class SceneResultAction extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键自增
     */
    private Long id;

    /**
     * 场景执行结果id
     */
    @Excel(name = "场景执行结果id")
    private long sceneResultId;

    /**
     * 设备id
     */
    private String deviceSn;

    /**
     * 预期值
     */
    @Excel(name = "预期值")
    private String expectValue;

    /**
     * 当前值
     */
    @Excel(name = "当前值")
    private String currentValue;

    /**
     * 执行结果,执行中 EXECUTING, 执行成功 SUCCESS, 执行失败 FAIL
     */
    @Excel(name = "执行结果")
    private String result;

    /**
     * 失败原因
     */
    @Excel(name = "失败原因")
    private String failReason;

    /**
     * 判断是否执行成功
     *
     * @return
     */
    public boolean valueEqual() {
        return StringUtils.isNotEmpty(expectValue) && StringUtils.isNotEmpty(currentValue) ? expectValue.equals(currentValue) : false;
    }

    public interface Add {
        //校验分组，添加
    }

}
